from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.ext.declarative import declarative_base

# 建立映射关系
Base = declarative_base()


class PrivateFundManagerClassificationInfo(Base):
    __tablename__ = 'private_fundManager_classification_list'  # 设置表名
    id = Column(Integer, primary_key=True)
    number = Column(Integer)  # 编号
    manager_name = Column(String(255))  # 私募基金管理人名称
    legal_representative = Column(String(255))  # 法定代表人/执行事务合伙人(委派代表)姓名
    institution_type = Column(String(255))  # 机构类型
    registration_number = Column(String(255))  # 登记编号
    registered_location = Column(String(255))  # 注册地
    office_location = Column(String(255))  # 办公地
    establishment_date = Column(DateTime)  # 成立时间
    registration_date = Column(DateTime)  # 登记时间
    fund_count = Column(Integer)  # 在管基金数量
    member_type = Column(String(255))  # 会员类型
    has_information_notice = Column(String(255))  # 是否有提示信息
    has_integrity_information = Column(String(255))  # 是否有诚信信息

    def __init__(self, number, manager_name, legal_representative, institution_type,
                 registration_number, registered_location, office_location, establishment_date,
                 registration_date, fund_count, member_type, has_information_notice, has_integrity_information):
        self.number = number
        self.manager_name = manager_name
        self.legal_representative = legal_representative
        self.institution_type = institution_type
        self.registration_number = registration_number
        self.registered_location = registered_location
        self.office_location = office_location
        self.establishment_date = establishment_date
        self.registration_date = registration_date
        self.fund_count = fund_count
        self.member_type = member_type
        self.has_information_notice = has_information_notice
        self.has_integrity_information = has_integrity_information

    def __str__(self):
        return (
            f"ID：{self.id}，"
            f"编号：{self.number}，"
            f"私募基金管理人名称：{self.manager_name}，"
            f"法定代表人/执行事务合伙人(委派代表)姓名：{self.legal_representative}，"
            f"机构类型：{self.institution_type}，"
            f"登记编号：{self.registration_number}，"
            f"注册地：{self.registered_location}，"
            f"办公地：{self.office_location}，"
            f"成立时间：{self.establishment_date}，"
            f"登记时间：{self.registration_date}，"
            f"在管基金数量：{self.fund_count}，"
            f"会员类型：{self.member_type}，"
            f"是否有提示信息：{self.has_information_notice}，"
            f"是否有诚信信息：{self.has_integrity_information}"
        )





def create_table(db):
    # 创建表
    Base.metadata.create_all(db)
